<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Upload extends CI_Controller{
	
	function index() {
		//laddar upload modellen
		$this->load->model('Upload_model');
		
		//Om användaren klickar på submit!
		if ($this->input->post('upload')) {
			//Ta title value
			$title = $this->input->post(TITLE);
			$path_title = str_replace(' ','_',$title);
			//Ta text
			$story = $this->input->post(STORY);
			//Ta kategori
			$category = $this->input->post(CATEGORIES);
			//Ta Caption
			$caption = $this->input->post(CAPTION);
			//Ta bild
			$this->Upload_model->do_upload($title, $story, $category, $caption, $path_title);
		}
		else{
			//tom
		}
	}
}